package com.om39a.plm.service;

import org.apache.http.client.HttpClient;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.params.HttpConnectionParams;
import org.apache.http.params.HttpParams;
import org.apache.log4j.Logger;

/**
 * @author om39a
 * 
 */
public class HttpClientFactory {

	private static Logger logger = Logger.getLogger(HttpClientFactory.class);

	private static HttpClient httpClient;

	private HttpClientFactory() {

	}

	public static HttpClient getDefaultInstance() {
		logger.info("Entering into getDefaultInstance()");
		if (httpClient == null) {
			httpClient = new DefaultHttpClient();
			HttpParams params = httpClient.getParams();
			HttpConnectionParams.setConnectionTimeout(params, 300000);
			HttpConnectionParams.setSoTimeout(params, 300000);
		}
		logger.info("Exiting from into HttpClient()");
		return httpClient;
	}

}
